﻿<Window x:Class="WgpgGUI.DialogGenerateKey"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:WgpgGUI"
        Title="Generate a new Key"
        SizeToContent="WidthAndHeight"
        ResizeMode="NoResize"
        MinWidth="500" MaxWidth="500"
        Icon="/WgpgCore;component/Images/newkey.png"
        WindowStartupLocation="CenterScreen">

    <DockPanel>
        <Grid Margin="10" DockPanel.Dock="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <TextBlock Margin="0 2 0 2" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0"><Bold>Your information</Bold></TextBlock>
            <TextBlock Margin="0 2 0 10" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1">The full name and the email address are required.</TextBlock>

            <Label Margin="0 2 0 2" Grid.Column="0" Grid.Row="2" Content="Full _Name: " Target="{Binding ElementName=fullname_textbox}" />
            <TextBox Margin="0 2 0 2" Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" Name="fullname_textbox" TextChanged="TextChanged">
                <TextBox.ToolTip>
                    <TextBlock>
                        Rules:<LineBreak/>
                        - May not begin by a digit<LineBreak/>
                        - Must have at least 1 character<LineBreak/>
                        - Must be less or equal than 255 characters<LineBreak/>
                        - May not contain &lt; or &gt;
                    </TextBlock>
                </TextBox.ToolTip>
            </TextBox>

            <Label Margin="0 2 0 2" Grid.Column="0" Grid.Row="3" Content="_Email Address: " Target="{Binding ElementName=email_textbox}" />
            <StackPanel Margin="0 2 0 2" Grid.Column="1" Grid.Row="3">
                <TextBox Name="email_textbox" TextChanged="TextChanged"/>
                <TextBlock Text="(example@wgpg.org)" Foreground="#787878"/>
            </StackPanel>
                
            <Label Margin="0 2 0 2" Grid.Column="0" Grid.Row="4" Content="C_omment: " />
            <TextBox Name="comment_textbox" Margin="0 2 0 2" Grid.Column="1" Grid.Row="4" VerticalAlignment="Center"/>

            <Expander Header="Advanced Options" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <TextBlock Margin="0 10 0 2" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0"><Bold>Key information</Bold></TextBlock>
                    <TextBlock Margin="0 2 0 10" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1">Specify here the algorithm, the expiration date and the size of your key.</TextBlock>

                    <Label Margin="0 2 0 2" Grid.Column="0" Grid.Row="2" Content="_Algorithm: " Target="{Binding ElementName=algorithm_combobox}" />
                    <ComboBox Margin="0 2 0 2" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" MinWidth="200" VerticalAlignment="Center" Name="algorithm_combobox" SelectionChanged="SelectionChanged">
                        <ComboBoxItem Content="DSA / ElGamal"/>
                        <ComboBoxItem Content="RSA" IsSelected="True"/>
                    </ComboBox>

                    <Label Margin="0 2 0 2" Grid.Column="0" Grid.Row="3" Content="Key _Size: " Target="{Binding ElementName=keysize_combobox}" />
                    <ComboBox Margin="0 2 0 2" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" MinWidth="200" VerticalAlignment="Center" Name="keysize_combobox">
                        <ComboBoxItem Content="1024"/>
                        <ComboBoxItem Content="2048"/>
                        <ComboBoxItem Content="3072"/>
                        <ComboBoxItem Content="4096" IsSelected="True" IsEnabled="{Binding Path=Items[1].IsSelected, ElementName=algorithm_combobox}"/>
                    </ComboBox>

                    <Label Margin="0 2 0 2" Grid.Column="0" Grid.Row="4" Content="Expiration _Date: " Target="{Binding ElementName=expirationdate_datepicker}"/>
                    <StackPanel Margin="0 2 0 2" Grid.Column="1" Grid.Row="4" Orientation="Horizontal">
                        <DatePicker Height="25" HorizontalAlignment="Left" Name="expirationdate_datepicker" MinWidth="200" IsEnabled="{Binding ElementName=expiration_checkbox, Path=IsChecked, Converter={StaticResource OppositeBoolConverter}}" VerticalAlignment="Center" LostFocus="DateLostFocus" />
                        <CheckBox VerticalAlignment="Center" Margin="40 0 0 0" IsChecked="True" Name="expiration_checkbox">
                            <Label Content="_Never Expires"/>
                        </CheckBox>
                    </StackPanel>
                </Grid>
            </Expander>
        </Grid>

        <StackPanel Background="#F0F0F0" DockPanel.Dock="Bottom" VerticalAlignment="Bottom">
            <Border BorderBrush="#DFDFE0" Height="1" BorderThickness="1"/>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Width="Auto" Content="_Generate" IsDefault="True" Click="Generate" IsEnabled="False" Name="generate_button"/>
                <Button Width="Auto" Content="_Cancel" IsCancel="True"/>
            </StackPanel>
        </StackPanel>
    </DockPanel>
</Window>
